package com.wang.result;

import com.wang.constant.CommonConstant;
import com.wang.constant.ErrorCode;
import lombok.Data;

@Data
public class BaseResponse<T> {
    private int code;
    private T data;
    private String message;
    
    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }
    
    public BaseResponse(int code, T data) {
        this(code, data, CommonConstant.SUCCESS);
    }

    public BaseResponse(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
        this.data = null;
    }

}
